<html>
<head>
<link rel="stylesheet" type="text/css" href="/static/styles.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="/static/scripts.js"></script>
<script type="text/javascript"></script>
</head>
<body>
{% include 'top.html' %}
<div class="centerDiv">
<h1>Match</h1><br/>
<form action="/saveMatch" method="post">
<table class="matchTable">
<tr>
<td class="name">Date:</td><td class="value"><input type="text" name="date" id="date" {% if matchProps['date'] %}value="{{ matchProps['date'] }}"{% endif %} {% if not isAdmin%} readonly="readonly" {% endif %} /></td>
</tr>
<tr>
<td class="name">Winner 1:</td><td class="value"><input type="text" name="winner1" id="winner1" {% if matchProps['winner1'] %}value="{{ matchProps['winner1'] }}"{% endif %} {% if not isAdmin%} readonly="readonly" {% endif %} /></td>
</tr>
<tr>
<td class="name">Winner 2:</td><td class="value"><input type="text" name="winner2" id="winner2" {% if matchProps['winner2'] %}value="{{ matchProps['winner2'] }}"{% endif %} {% if not isAdmin%} readonly="readonly" {% endif %} /></td>
</tr>
<tr>
<td class="name">Result:</td><td>Team 1: <input type="text" name="scoreTeam1" id="scoreTeam1"/> Team 2: <input type="text" name="scoreTeam1" id="scoreTeam2"/></td>
</tr>
<tr>
<td class="name">Players:</td>
<td>
<div class="playerListDiv">
{% for player in matchProps['playerList'] %}
<div id="{{ player.username }}PlrDiv">{{ player.nickname() }} <button name="removePlayer"></button></div>
{% endfor %}
</div>
</td>
</tr>
{% if isAdmin %}
<tr>
<td></td>
<td>
<input class="addPlayerInput" id="addPlayer" type="button" value="Add Player"/>
<div class="addPlayerDiv">
<input type="text" name="newPlayer" id="newPlayer"/><input type="button" value="Submit player" name="newPlayerBtn" id="newPlayerBtn" />
</div>
</td>
</tr>
{% endif %}
<tr>
<td></td>
<td>
<input id="signUp" type="button" value="I'm going!" {% if disableSignUp==True %}disabled="disabled"{% endif %} />
<input id="signOut" type="button" value="I'm not going!" {% if disableSignUp!=True %}disabled="disabled"{% endif %}/>
<input type="button" value="Back" onClick="history.go(-1);"/>
</td>
</tr>
{% if isAdmin %}<tr><td></td><td><input type="submit" value="Save match!" /></td></tr>{% endif %}
</table>
<input name="key" id="key" type="hidden" value="{{ key }}" />
</form>
</div>
</body>
</html>